<?php
namespace app\server;

use Swoole\WebSocket\Frame;
use Swoole\WebSocket\Server;
use think\swoole\contract\websocket\ParserInterface;

class Parser implements ParserInterface
{
    
    /**
     * @return boolean
     */
    public function execute($server, $frame){
        return false;
    }
    /**
     *
     * @param string $event
     * @param [type] $data
     * @return void
     * @author  autumu
     */
    public function encode(string $event, $data)
    {
        //echo "encode";
    }
    
    public function decode($frame)
    {
        $data = json_decode($frame->data,true);
        return $data;
    }
}